<!-- 评估结果汇总表 -->
<template>
  <div class="fcontainer">
    <el-table
      :data="tableData"
      :show-header="false"
      :span-method="objectSpanMethod"
      border
      :row-class-name="getRowClassName"
      :cell-style="{ borderColor: '#bbb' }"
      :header-cell-style="{ borderColor: '#bbb' }"
      style="width: 80%; --el-table-border-color: #bbb"
    >
      <el-table-column
        class-name="one-index"
        prop="oneIndex"
        label=""
        align="center"
      />
      <el-table-column
        class-name="two-index"
        prop="twoIndex"
        label=""
        align="center"
      />
      <el-table-column
        class-name="three-index"
        prop="threeIndex"
        label=""
        align="center"
      />
      <el-table-column
        class-name="four-index"
        prop="fourIndex"
        label=""
        align="center"
      />
      <el-table-column
        class-name="five-index"
        prop="fiveIndex"
        label=""
        align="center"
      />
      <el-table-column
        class-name="six-index"
        prop="sixIndex"
        label=""
        align="center"
      />
    </el-table>
  </div>
</template>
<script setup name="sureTemplate">
const getRowClassName = ({ row, rowIndex }) => {
  // 这里可以访问到行数据 row 和行索引 rowIndex
  console.log("---8899---");
  console.log(row, rowIndex);
  if (rowIndex === 0 || rowIndex === 3) {
    return "add-background";
  }
  if (rowIndex === 1 || rowIndex === 2) {
    return "left-align";
  }
  if (rowIndex > 4) {
    return "delete-background";
  }
  return "";
};
const tableData = ref([
  {
    oneIndex: "评估结果汇总表",
    twoIndex: "",
    threeIndex: "",
    fourIndex: "",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "评估基准日:",
    twoIndex: "",
    threeIndex: "2014-12-31	",
    fourIndex: "	",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "被评估单位:",
    twoIndex: "",
    threeIndex: "嘉亿(北京)股权投资基金管理有限公司股东全部",
    fourIndex: "",
    fiveIndex: "金额单位:人民币元",
    sixIndex: "",
  },
  {
    oneIndex: "项目",
    twoIndex: "审计前账面价值",
    threeIndex: "账面价值",
    fourIndex: "评估价值",
    fiveIndex: "增减值",
    sixIndex: "增减率(%)",
  },
  {
    oneIndex: "流动资产",
    twoIndex: "10,129.1698",
    threeIndex: "10,129.1698",
    fourIndex: "10,129.1693",
    fiveIndex: "0.00",
    sixIndex: "0.00",
  },
  {
    oneIndex: "非流动资产",
    twoIndex: "2.3868",
    threeIndex: "2.3868",
    fourIndex: "2.2254",
    fiveIndex: "—0.1614",
    sixIndex: "6.76",
  },
  {
    oneIndex: "其中:可供出售金融资产",
    twoIndex: "",
    threeIndex: "",
    fourIndex: "",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "持有至到期投资",
    twoIndex: "",
    threeIndex: "",
    fourIndex: "",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "长期应收款",
    twoIndex: "",
    threeIndex: "",
    fourIndex: "",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "长期股权投资",
    twoIndex: "",
    threeIndex: "",
    fourIndex: "",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "投资性房地产",
    twoIndex: "",
    threeIndex: "",
    fourIndex: "",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "固定资产",
    twoIndex: "2.3868",
    threeIndex: "2.3868",
    fourIndex: "2.2254",
    fiveIndex: "—0.1614",
    sixIndex: "-6.76",
  },
  {
    oneIndex: "在建工程",
    twoIndex: "",
    threeIndex: "",
    fourIndex: "",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "工程物资",
    twoIndex: "",
    threeIndex: "",
    fourIndex: "",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "固定资产清理",
    twoIndex: "",
    threeIndex: "",
    fourIndex: "",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "生产性生物资产",
    twoIndex: "",
    threeIndex: "",
    fourIndex: "",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "油气资产",
    twoIndex: "",
    threeIndex: "",
    fourIndex: "",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "无形资产",
    twoIndex: "",
    threeIndex: "",
    fourIndex: "",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "开发支出",
    twoIndex: "",
    threeIndex: "",
    fourIndex: "",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "商誉",
    twoIndex: "",
    threeIndex: "",
    fourIndex: "",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "长期待摊费用",
    twoIndex: "",
    threeIndex: "",
    fourIndex: "",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "递延所得税资产",
    twoIndex: "",
    threeIndex: "",
    fourIndex: "",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "其他非流动资产",
    twoIndex: "",
    threeIndex: "",
    fourIndex: "",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "资产总计",
    twoIndex: "10,131 5560",
    threeIndex: "10,131 5560",
    fourIndex: "10, 131. 3947",
    fiveIndex: "-0.1613",
    sixIndex: "0.00",
  },
  {
    oneIndex: "流动负债",
    twoIndex: "164. 2384",
    threeIndex: "164. 2384",
    fourIndex: "164. 2384",
    fiveIndex: "0.00",
    sixIndex: "0.00",
  },
  {
    oneIndex: "非流动负债",
    twoIndex: "",
    threeIndex: "",
    fourIndex: "",
    fiveIndex: "",
    sixIndex: "",
  },
  {
    oneIndex: "负债合计",
    twoIndex: "164.2384",
    threeIndex: "164.2384",
    fourIndex: "164.2384",
    fiveIndex: "0.00",
    sixIndex: "0.00",
  },
]);
const objectSpanMethod = ({ rowIndex, columnIndex }) => {
  // rowIndex, // 行索引  columnIndex, // 列索引
  if (columnIndex == 0) {
    if (rowIndex === 0) {
      return {
        rowspan: 1,
        colspan: 6,
      };
    }
    if (rowIndex === 1 || rowIndex === 2) {
      return {
        rowspan: 1,
        colspan: 2,
      };
    }
  } else if (columnIndex == 1) {
    if (rowIndex === 1 || rowIndex === 2) {
      return {
        rowspan: 0,
        colspan: 0,
      };
    }
  } else if (columnIndex == 2) {
    if (rowIndex === 1 || rowIndex === 2) {
      return {
        rowspan: 1,
        colspan: 2,
      };
    }
  } else if (columnIndex == 3) {
    if (rowIndex === 1 || rowIndex === 2) {
      return {
        rowspan: 0,
        colspan: 0,
      };
    }
  } else if (columnIndex == 4) {
    if (rowIndex === 1 || rowIndex === 2) {
      return {
        rowspan: 1,
        colspan: 3,
      };
    }
  } else if (columnIndex == 5) {
    if (rowIndex === 1) {
      return {
        rowspan: 0,
        colspan: 0,
      };
    }
  } else {
    return {
      rowspan: 1,
      colspan: 1,
    };
  }
};
</script>

<style scoped lang="scss">
.fcontainer {
  :deep(.el-table) {
    .one-index {
      background-color: #e4f6fd;
    }
    .bold .one-index {
      font-weight: bold;
    }
    .add-background {
      font-weight: bold;
      background-color: #e4f6fd;
    }
    .left-align {
      .one-index,
      .three-index {
        text-align: left !important;
      }
      .five-index {
        text-align: right !important;
      }
    }
    .delete-background .four-index {
      background: transparent !important;
      font-weight: normal !important;
    }
    .el-table__body-wrapper {
      border-color: #bbb !important; /* 例如：#f00（红色） */
    }
    .el-table__header-wrapper {
      border-color: #bbb !important; /* 例如：#f00（红色） */
    }
  }
}
</style>

